import Request from '@/utils/request.js'

// 添加用户答案
export const AddUserAnswer = (answerData) => {
    return Request.post("/userAnswer/add", answerData);
}

// 删除用户答案
export const DeleteUserAnswer = (answerId) => {
    return Request.delete(`/userAnswer/delete?id=${answerId}`);
};

// 更新用户答案（仅管理员）
export const UpdateUserAnswer = (answerData) => {
    return Request.post("/userAnswer/update", answerData);
}

// 获取用户答案（通过ID）
export const GetUserAnswerById = (answerId) => {
    return Request.get(`/userAnswer/getById?id=${answerId}`);
}

// 分页获取用户答案列表（仅管理员）
export const ListUserAnswersByPage = (queryParams) => {
    return Request.post("/userAnswer/listByPage", queryParams,{
        headers: {
            'Content-Type': 'application/json'
        }
    });
}

// 分页获取用户答案列表封装类
export const ListUserAnswerVOsByPage = (queryParams) => {
    return Request.post("/userAnswer/listVOByPage", queryParams);
}

// 分页获取当前用户自己的答案列表
export const ListMyUserAnswersByPage = (queryParams) => {
    return Request.post("/userAnswer/listMyByPage", queryParams);
}

// 编辑用户答案
export const EditUserAnswer = (editData) => {
    return Request.patch("/userAnswer/edit", editData);
}